VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "DAOParametro"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
Private mvarConnection As utilConexion 'local copy

Public Property Set Connection(ByVal vData As utilConexion)
'used when assigning an Object to the property, on the left side of a Set statement.
'Syntax: Set x.Connection = vData
    Set mvarConnection = vData
End Property


Public Function getBParametro() As bparametro
'On Error GoTo hnderr
Dim sql As String
Dim rst As New Recordset
Dim bean As New bparametro
sql = "SELECT ntipcambio , nigv , ndiatrabajo FROM proc_parametro_select();"
rst.Open sql, mvarConnection.Connection, adOpenForwardOnly
If Not rst.EOF Then
    If Not IsNull(rst.Fields("ntipcambio")) Then bean.nTipoCambio = rst.Fields("ntipcambio").value
    If Not IsNull(rst.Fields("nigv")) Then bean.nIgv = rst.Fields("nigv").value
    If Not IsNull(rst.Fields("ndiatrabajo")) Then bean.nDiaTrabajo = rst.Fields("ndiatrabajo").value
End If
Set getBParametro = bean
hnderr:
If Err.Number = 0 Then Exit Function
cloneError Err
End Function



Public Function actualizarTipoCambio(bean As bparametro) As Integer
Dim sql As String
sql = "SELECT * FROM proc_parametro_update_tipocambio(" + CStr(bean.nTipoCambio) + " );"
mvarConnection.Connection.Execute sql
actualizarTipoCambio = UtilConstantes.OPT_DATOS_GUARDADOS
hnderr:
If Err.Number = 0 Then Exit Function
cloneError Err
actualizarTipoCambio = UtilConstantes.OPT_ERROR_ENCONTRADO
End Function

Public Function cierraDiaTrabajo() As Integer
Dim sql As String
Dim rst As New Recordset
sql = "select * from proc_cierradiatrabajo();"
Set rst = mvarConnection.Connection.Execute(sql)
If Not rst Then
    If Not IsNull(rst.Fields(0)) Then bparametro.nDiaTrabajo = rst.Fields(0).value
End If
cierraDiaTrabajo = UtilConstantes.OPT_DATOS_GUARDADOS
hnderr:
If Err.Number = 0 Then Exit Function
cloneError Err
cierraDiaTrabajo = UtilConstantes.OPT_ERROR_ENCONTRADO


End Function
